<#assign domain="${ctx.contextPath}" />
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv=”X-UA-Compatible” content=”IE=edge”>
	<meta name="renderer" content="webkit">
	<title>orderManagement</title>
	<link rel="stylesheet" href="${domain}/static/css/common/bootstrap.min.css">
	<link rel="stylesheet" href="${domain}/static/css/common/base.css">
	<link rel="stylesheet" href="${domain}/static/css/common/header.css">
	<link rel="stylesheet" href="${domain}/static/css/orderManagement.css">
	<script src="${domain}/static/js/jquery-3.2.1.min.js"></script>
	<script src="${domain}/static/js/bootstrap.min.js"></script>
</head>
<body>
<div class="content">
	<!--订单管理内容-->
	<div class="order-management">
		<div class="txt-info">
			<h2>${ shop.name }</h2>
			<span>可用余额:${ shop.balance }</span>
		</div>
		<div class="table-responsive">
			<table class="table table-striped">
				<thead>
				<tr>
					<th>名称</th>
					<th>查询次数</th>
					<th>查询时间</th>
					<th>操作</th>
				</tr>
				</thead>
				<tbody>
				<#list pm.list as orderList>
				<tr>
					<td style="display: none;">${orderList.id}</td>
					<td id="name">${orderList.name}</td>
					<td>
						<#if orderList.userid!=null>
							${orderList.orderCount}
						<#else>
						    0
						</#if>
					</td>
					<td>
						${(orderList.maxTime?string("yyyy-MM-dd"))!'无查询记录 '}
						</td>
					<td>
					    <button class="btn btn-default b-blue" style="margin-right: 10px;" onclick="window.location.href='${domain}/External/getOrderPage?userId=${orderList.id}';">
					         查看
					    </button>
	                    <#if  orderList.type !=0 >
						    <button class="btn btn-default b-danger" name="deleteButton" data-toggle="modal" data-target="#exampleModal" data-whatever="@mdo">
						          删除
						    </button>
					    </#if>  
				    </td>
				</tr>
				</#list>
				</tbody>
			</table>
			<div class="paging">
				共${pm.sumCount }条数据&nbsp;&nbsp;第${pm.currentPage }/${pm.sumPage }页&nbsp;&nbsp;
					<#if pm.currentPage<=1>
					  <a>  	
					  	           上一页
					  </a>
					<#else> 
					    <a onclick="window.location.href='${domain}/External/getOrderInfoPage?pageNo=${pm.currentPage - 1}';">
				                                   上一页
				        </a>
					</#if>
				&nbsp;&nbsp;
					<#if pm.currentPage = pm.sumPage>
						<a>	
							下一页
						</a>
					<#else> 
					    <a onclick="window.location.href='${domain}/External/getOrderInfoPage?pageNo=${pm.currentPage+1}';">
							下一页
						</a>
					</#if>
			</div>
		</div>
	</div>
</div>
<!--
	作者：offline
	时间：2017-10-23
	描述：弹出框
-->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="exampleModalLabel">提示信息</h4>
      </div>
      <div class="modal-body">
        <p>是否删除订单</p>
      </div>
      <div class="modal-footer">
      	<button type="button" class="btn btn-primary" id="deleteOrder">确定</button>
        <button type="button" class="btn btn-default" data-dismiss="modal" id="close">取消</button>
      </div>
    </div>
  </div>
</div>
</body>
<script type="text/javascript">
$('#exampleModal').on('hidden.bs.modal', function (e) {
  console.log('返回');
});

$("button[name='deleteButton']").on("click",function(){
	console.log("弹窗");
	var orderId  = $(this).parent().parent().children()[0].innerText;
	
	$("#deleteOrder").on("click",function(){
		console.log("删除订单： "+orderId);
        window.location.href="${domain}/External/updateOrderInfo?userId="+orderId+"";
	});
});
</script>
</html>